<?php

namespace App\Repositories;

use Prettus\Repository\Eloquent\BaseRepository;
use Prettus\Repository\Criteria\RequestCriteria;
use App\Repositories\DormMeterRecordRepository;
use App\Models\DormMeterRecord;
use App\Validators\DormMeterRecordValidator;

/**
 * Class DormMeterRecordRepositoryEloquent.
 *
 * @package namespace App\Repositories;
 */
class DormMeterRecordRepositoryEloquent extends BaseRepository implements DormMeterRecordRepository
{
    /**
     * Specify Model class name
     *
     * @return string
     */
    public function model()
    {
        return DormMeterRecord::class;
    }

    /**
    * Specify Validator class name
    *
    * @return mixed
    */
    public function validator()
    {

        return DormMeterRecordValidator::class;
    }


    /**
     * Boot up the repository, pushing criteria
     */
    public function boot()
    {
        $this->pushCriteria(app(RequestCriteria::class));
    }

    public function init($data){
        return $this->model->insert($data);
    }

protected $fieldSearchable =[
    'dorm.code'=>'like',
    'created_at',
    'period.name',
    'period_id',
    'dorm.building.id',
    'meter_type_id',
];
}
